Skip to content

Commit 32c294f

Browse files
committed
1.0.0 draft before major version upgrade
1 parent 82e3b14 commit 32c294f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+9257
-9660
lines changed

README.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -403,18 +403,15 @@ TODO
403403
----
404404

405405
`gtools` is feature-frozen. Other than bug fixes, no new features will
406-
be added until version 1.0. All that remains is improving the coverage
407-
of the debug checks before submitting to SSC.
406+
be added until version 1.0.
408407

409-
Roadmap to 1.0
410-
411-
- [ ] Improve coverage of debug checks.
408+
- [X] Improve coverage of debug checks.
412409
- [X] Test `nunique` for gegen and gcollapse (vs `gunique`)
413-
- [ ] Have corner cases for ALL commands
414-
- [ ] Test all the options in every command
415-
- [ ] Test errors (i.e. make sure commands fail as expected).
416-
- [ ] Test weights in `gtop`.
417-
- [ ] Test `gen` and `nolocal` in `glevelsof`.
410+
- [X] Have corner cases for ALL commands
411+
- [X] Test all the options in every command
412+
- [X] Test errors (i.e. make sure commands fail as expected).
413+
- [X] Test weights in `gtop`.
414+
- [X] Test `gen` and `nolocal` in `glevelsof`.
418415
- [X] Weights in `gquantiles`.
419416
- [X] Add (partial) support for `strL` variables.
420417
- [X] Add support for `by` in `gunique`
@@ -436,7 +433,7 @@ Roadmap to 1.0
436433
- [X] Add weights in `gtop`.
437434

438435
These are options/features I would like to support, but I don't have an
439-
ETA for them (and they almost surely won't make it to the 1.0 release).
436+
ETA for them (and they won't make it to the 1.0 release).
440437

441438
- [ ] Add support for binary `strL` variables.
442439
- [ ] Minimize memory use.

build/_gtools_internal.ado

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2057,6 +2057,9 @@ program _gtools_internal, rclass
20572057
J(1, max(`=scalar(__gtools_xtile_nq2)', `nquantiles' - 1), 0)
20582058
local __gtools_xtile_nq_extra `__gtools_xtile_nq_extra' quantiles
20592059
}
2060+
else if ( (`=scalar(__gtools_xtile_nq2)' > 0) & ("`_pctile'" != "") ) {
2061+
* matsize for nq2 was already checked
2062+
}
20602063
else if ( "`_pctile'" != "" ) {
20612064
disp as txt "(option _pctile ignored)"
20622065
}

build/changelog.md

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
Change Log
22
==========
33

4+
## gtools-1.0.0 (2018-07-21)
5+
6+
First official release! This will go on SSC once all the tests have
7+
passed.
8+
9+
------------------------------------------------------------------------
10+
411
## gtools-0.14.2 (2018-07-21)
512

613
Feature freeze!
@@ -17,6 +24,10 @@ Feature freeze!
1724
* Added `gen()` to the quick `glevelsof' showcase
1825
* Added `gen()` to the `glevelsof' usage page and examples.
1926

27+
### Bug Fixes
28+
29+
* `gegen()` with `replace` sets missing values outside `if in` range.
30+
2031
## gtools-0.14.1 (2018-07-19)
2132

2233
### Features
@@ -49,6 +60,8 @@ Feature freeze!
4960
existing variables gets a warning.
5061
* Fixes https://github.com/mcaceresb/stata-gtools/issues/42 `gunique` typo.
5162

63+
------------------------------------------------------------------------
64+
5265
## gtools-0.13.3 (2018-05-06)
5366

5467
### Features
@@ -105,6 +118,8 @@ right-exclusive, would give the wrong quantile.
105118
- `skew`, `kurt` give the correct answer when the group is a singleton
106119
or when all observations are the same.
107120

121+
------------------------------------------------------------------------
122+
108123
## gtools-0.12.8 (2018-04-23)
109124

110125
### Features
@@ -192,6 +207,8 @@ requests them with weights, the weighted version will still be called
192207
(OSX pending). gegen does not support weights with multiple
193208
sources (e.g. `sum(x y z)`).
194209

210+
------------------------------------------------------------------------
211+
195212
## gtools-0.11.5 (2018-01-16)
196213

197214
### Features
@@ -279,6 +296,8 @@ requests them with weights, the weighted version will still be called
279296
more characters than contained in the numfmt local macro. This
280297
could cause problems on some systems.
281298

299+
------------------------------------------------------------------------
300+
282301
## gtools-0.10.3 (2017-11-12)
283302

284303
### Bug fixes
@@ -328,6 +347,8 @@ requests them with weights, the weighted version will still be called
328347
- Fixed numerical precision issue with quantiles.
329348
Now ((ST_double) N / 100) is computed first.
330349

350+
------------------------------------------------------------------------
351+
331352
## gtools-0.9.4 (2017-11-03)
332353

333354
### Bug fixes
@@ -397,6 +418,8 @@ requests them with weights, the weighted version will still be called
397418
- Added quotes to `cd cwd` in `gtools`; fixes https://github.com/mcaceresb/stata-gtools/issues/22
398419
- `gcontract` available; fixes https://github.com/mcaceresb/stata-gtools/issues/23
399420

421+
------------------------------------------------------------------------
422+
400423
## gtools-0.8.5 (2017-10-30)
401424

402425
### Features
@@ -476,6 +499,8 @@ requests them with weights, the weighted version will still be called
476499
* Fixes https://github.com/mcaceresb/stata-gtools/issues/18
477500
* Fixes https://github.com/mcaceresb/stata-gtools/issues/11
478501

502+
------------------------------------------------------------------------
503+
479504
## gtools-0.7.5 (2017-10-08)
480505

481506
### Features
@@ -545,6 +570,8 @@ requests them with weights, the weighted version will still be called
545570

546571
* `gcollapse, unsorted` no longer supported (due to internal sorting)
547572

573+
------------------------------------------------------------------------
574+
548575
## gtools-0.6.17 (2017-09-17); fixes #15
549576

550577
### Bug fixes
@@ -761,7 +788,7 @@ requests them with weights, the weighted version will still be called
761788
the implementation this may be slower because adding variables takes
762789
longer with more variables in memory.)
763790

764-
---
791+
------------------------------------------------------------------------
765792

766793
## gtools-0.5.2 (2017-06-15)
767794

@@ -870,7 +897,7 @@ requests them with weights, the weighted version will still be called
870897
* If you sort the data in C, then assert the sort is unique and
871898
print "(hashed correctly grouped observations: resulting sort is unique)"
872899

873-
---
900+
------------------------------------------------------------------------
874901

875902
## gtools-0.4.1 (2017-05-29)
876903

@@ -929,7 +956,8 @@ requests them with weights, the weighted version will still be called
929956
print "(hashed correctly grouped observations: resulting sort is unique)"
930957
* Be smart about memory management when J is small relative to N.
931958

932-
---
959+
------------------------------------------------------------------------
960+
933961

934962
## gtools-0.3.3 (2017-05-21)
935963

build/fasterxtile.ado

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,16 @@ program define fasterxtile
2424
///
2525
method(passthru) /// Quantile method: (1) qsort, (2) qselect
2626
strict /// Exit if nquantiles > # non-missing obs
27+
///
28+
compress /// Try to compress strL variables
29+
forcestrl /// Force reading strL variables (stata 14 and above only)
2730
Verbose /// Print info during function execution
28-
BENCHmark /// Benchmark function
29-
BENCHmarklevel(passthru) /// Benchmark various steps of the plugin
30-
HASHmethod(passthru) /// Hashing method: 1 (biject), 2 (spooky)
31+
BENCHmark /// print function benchmark info
32+
BENCHmarklevel(passthru) /// print plugin benchmark info
33+
HASHmethod(passthru) /// Hashing method: 0 (default), 1 (biject), 2 (spooky)
3134
hashlib(passthru) /// (Windows only) Custom path to spookyhash.dll
3235
oncollision(passthru) /// error|fallback: On collision, use native command or throw error
3336
///
34-
forcestrl ///
35-
compress ///
3637
debug(passthru) ///
3738
GROUPid(passthru) ///
3839
tag(passthru) ///

build/gcollapse.ado

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ program gcollapse, rclass
2121
///
2222
merge /// Merge statistics back to original data, replacing if applicable
2323
replace /// Allow replacing existing variables with output with merge
24-
compress /// Try to compress strL variables
25-
forcestrl /// Force reading strL variables (stata 14 and above only)
2624
freq(passthru) /// Include frequency count with observations per group
2725
///
2826
LABELFormat(passthru) /// Custom label engine: (#stat#) #sourcelabel# is the default
@@ -40,16 +38,18 @@ program gcollapse, rclass
4038
forcemem /// Use memory for writing/reading collapsed data
4139
double /// Generate all targets as doubles
4240
///
41+
compress /// Try to compress strL variables
42+
forcestrl /// Force reading strL variables (stata 14 and above only)
4343
Verbose /// Print info during function execution
4444
BENCHmark /// print function benchmark info
4545
BENCHmarklevel(int 0) /// print plugin benchmark info
46-
///
4746
HASHmethod(passthru) /// Hashing method: 0 (default), 1 (biject), 2 (spooky)
47+
///
4848
hashlib(passthru) /// (Windows only) Custom path to spookyhash.dll
4949
oncollision(passthru) /// error|fallback: On collision, use native command or throw error
5050
///
51-
debug /// (internal) Allow replacing by variables with output
52-
DEBUG_level(int 0) /// (internal) Allow replacing by variables with output
51+
debug /// (internal) Debug
52+
DEBUG_level(int 0) /// (internal) Debug (passed to internals)
5353
debug_replaceby /// (internal) Allow replacing by variables with output
5454
debug_io_read(int 1) /// (internal) Read IO data using mata or C
5555
debug_io_check(real 1e6) /// (internal) Threshold to check for I/O speed gains
@@ -395,7 +395,8 @@ program gcollapse, rclass
395395

396396
qui mata: st_addvar(__gtools_gc_recasttypes, __gtools_gc_recastvars, 1)
397397
if ( `=_N > 0' ) {
398-
cap noi _gtools_internal, recast(targets(`gtools_recastvars') sources(`gtools_recastsrc'))
398+
cap noi _gtools_internal, ///
399+
recast(targets(`gtools_recastvars') sources(`gtools_recastsrc'))
399400
if ( _rc ) {
400401
local rc = _rc
401402
CleanExit
@@ -481,13 +482,16 @@ program gcollapse, rclass
481482
local sources sources(`__gtools_gc_vars')
482483
local stats stats(`__gtools_gc_stats')
483484
local targets targets(`__gtools_gc_targets')
484-
local opts missing replace `keepmissing' `compress' `forcestrl' debug(`debug_level')
485-
local opts `opts' `verbose' `benchmark' `benchmarklevel' `hashlib' `oncollision' `hashmethod'
485+
local opts missing replace `keepmissing' `compress' `forcestrl'
486+
local opts `opts' `verbose' `benchmark' `benchmarklevel' `hashmethod'
487+
local opts `hashlib' `oncollision' debug(`debug_level')
486488
local opts `opts' `anymissing' `allmissing' `rawstat'
487489
local action `sources' `targets' `stats'
488490

489491
local switch = (`=scalar(__gtools_gc_k_extra)' > 3) & (`debug_io_check' < `=_N')
490-
local mem = ("`forcemem'" != "") | ("`merge'" != "") | (`=scalar(__gtools_gc_k_extra)' == 0)
492+
local mem = ("`forcemem'" != "") ///
493+
| ("`merge'" != "") ///
494+
| (`=scalar(__gtools_gc_k_extra)' == 0)
491495
local io = ("`forceio'" != "") & (`=scalar(__gtools_gc_k_extra)' > 0)
492496

493497
if ( `io' ) {
@@ -518,7 +522,10 @@ program gcollapse, rclass
518522
* Benchmark adding 2 variables to gauge how long it might take to
519523
* add __gtools_gc_k_extra variables.
520524
tempvar __gtools_gc_index __gtools_gc_ix __gtools_gc_info
521-
cap noi benchmark_memvars, index(`__gtools_gc_index') ix(`__gtools_gc_ix') info(`__gtools_gc_info')
525+
cap noi benchmark_memvars, ///
526+
index(`__gtools_gc_index') ///
527+
ix(`__gtools_gc_ix') ///
528+
info(`__gtools_gc_info')
522529
if ( _rc ) {
523530
local rc = _rc
524531
CleanExit
@@ -561,10 +568,14 @@ program gcollapse, rclass
561568
gtools_timer info 97 `"`msg'"', prints(`bench')
562569

563570
if ( ("`forceio'" == "forceio") & (`=scalar(__gtools_gc_k_extra)' == 0) ) {
564-
if ( `verb' ) di as text "(ignored -forceio- because sources are being used as targets)"
571+
if ( `verb' ) {
572+
di as text "(ignored -forceio- because sources are being used as targets)"
573+
}
565574
}
566575

567-
if ( "`added'" != "" ) qui mata: st_addvar(__gtools_gc_addtypes, __gtools_gc_addvars, 1)
576+
if ( "`added'" != "" ) {
577+
qui mata: st_addvar(__gtools_gc_addtypes, __gtools_gc_addvars, 1)
578+
}
568579
local msg "Generated additional targets"
569580
gtools_timer info 97 `"`msg'"', prints(`bench')
570581

@@ -672,7 +683,10 @@ program gcollapse, rclass
672683
* If we collapsed to disk, read back the data
673684
* -------------------------------------------
674685

675-
if ( (`=_N > 0') & (`=scalar(__gtools_gc_k_extra)' > 0) & ( `used_io' | ("`forceio'" == "forceio") ) ) {
686+
local ifcond (`=_N > 0') ///
687+
& (`=scalar(__gtools_gc_k_extra)' > 0) ///
688+
& ( `used_io' | ("`forceio'" == "forceio") )
689+
if ( `ifcond' ) {
676690
gtools_timer on 97
677691

678692
qui mata: st_addvar(__gtools_gc_addtypes, __gtools_gc_addvars, 1)
@@ -805,7 +819,10 @@ end
805819

806820
cap mata: mata drop gtools_get_collapsed()
807821
mata
808-
real matrix function gtools_get_collapsed(string scalar fname, real scalar nrow, real scalar ncol)
822+
real matrix function gtools_get_collapsed(
823+
string scalar fname,
824+
real scalar nrow,
825+
real scalar ncol)
809826
{
810827
real scalar fh
811828
real matrix X
@@ -1212,7 +1229,11 @@ program parse_keep_drop, rclass
12121229
else {
12131230
* We only recast integers. Floats and doubles are preserved unless
12141231
* requested or the target is a sum.
1215-
parse_ok_astarget, sourcevar(`var') targetvar(`var') stat(`collstat') `double' `weights'
1232+
parse_ok_astarget, ///
1233+
sourcevar(`var') ///
1234+
targetvar(`var') ///
1235+
stat(`collstat') ///
1236+
`double' `weights'
12161237
local recast = !(`r(ok_astarget)')
12171238

12181239
if ( `recast' ) {

0 commit comments

Comments
 (0)