Skip to content

Commit

Permalink
Merge branch 'develop' into bugfix/issue-530-no-model-parameters: mov…
Browse files Browse the repository at this point in the history
…ing test to CmdStan branch bugfix/issue-530-no-model-parameters

Conflicts:
	src/test/CmdStan/fixed_param_sampler_test.cpp
  • Loading branch information
syclik committed Mar 7, 2014
2 parents 070f5da + 47e9541 commit f1373d2
Show file tree
Hide file tree
Showing 228 changed files with 3,877 additions and 9,075 deletions.
24 changes: 8 additions & 16 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
/*.dSYM
/bin

# precompiled model header
/src/stan/model/model_header.hpp.*ch

# other binary
*.o
*.exe
Expand All @@ -32,23 +29,18 @@ stan.kdev4
.Rapp.history

# models:
src/models/**/*
!src/models/**/*.stan
!src/models/**/*.R
!src/models/**/makefile
/src/models/**
!/src/models/**.stan
!/src/models/**.R
!/src/models/**/makefile

# tests: compiled models
src/test/test-models/**/*
!src/test/test-models/**/*.stan
!src/test/test-models/**/.gitignore
/src/test/test-models/**
!/src/test/test-models/**.stan
!/src/test/test-models/**/.gitignore

# tests: generated agrad tests
src/test/unit-distribution/**/**/**/*_generated_test.cpp
/src/test/unit-distribution/*/*/*/*_generated_test.cpp

# For the Mac
*.DS_Store

#auto generated by RStan make
rstan/rstan/R/git_head.R
rstan/rstan/inst/include/stanlib
rstan/rstan/inst/include/stansrc
4 changes: 4 additions & 0 deletions make/os_linux
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ ifeq (mingw32-g++,$(CC_TYPE))
endif
ifeq (clang++,$(CC_TYPE))
# CFLAGS += -stdlib=libc++
ifeq (true,$(C++11))
CFLAGS += -stdlib=libc++ -std=c++11
LDFLAGS += -lc++
endif
CFLAGS_GTEST += -DGTEST_HAS_PTHREAD=0
CFLAGS_GTEST += -Wno-c++11-long-long
CFLAGS += -Wno-unused-function
Expand Down
5 changes: 5 additions & 0 deletions make/os_mac
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ ifeq (g++,$(CC_TYPE))
CFLAGS += -ftemplate-depth-$(TEMPLATE_DEPTH)
endif
endif

ifeq (clang++,$(CC_TYPE))
CFLAGS_GTEST += -Wc++11-extensions
CFLAGS_GTEST += -Wno-c++11-long-long
CFLAGS += -Wno-unused-function
CFLAGS += -Wno-tautological-compare
CFLAGS += -Wno-c++11-long-long
ifeq (true,$(C++11))
CFLAGS += -stdlib=libc++ -std=c++11
endif
#PCH = .pch
ifeq (4.2,$(CC_MAJOR).$(CC_MINOR))
TEMPLATE_DEPTH ?= 256
CFLAGS += -ftemplate-depth=$(TEMPLATE_DEPTH)
Expand Down
52 changes: 22 additions & 30 deletions make/tests
Original file line number Diff line number Diff line change
Expand Up @@ -172,16 +172,10 @@ endif

##
# TEST_MODELS is the set of all the test models.
# Those in the 'compiled' subdirectory are supposed to be compiled.
# Those in the 'no_main' subdirectory are supposed to be compiled without a main function.
##
TEST_MODELS := $(shell find src/test/test-models -type f -name '*.stan')

##
# Compile these with a main.
##
$(patsubst %.stan,%.cpp,$(filter src/test/test-models/compiled/%,$(TEST_MODELS))) : %.cpp : %.stan bin/stanc$(EXE)
bin$(PATH_SEPARATOR)stanc$(EXE) --o=$@ $<
##
# Compile these with no main.
##
Expand All @@ -193,8 +187,6 @@ $(patsubst %.stan,%.cpp,$(filter src/test/test-models/no-main/%,$(TEST_MODELS)))
# Tests that also depend on generated models.
##
test/unit/io/mcmc_writer.o: src/test/test-models/no-main/io_example.cpp
test/unit/gm/command_init.o: src/test/test-models/no-main/gm/test_lp.cpp
test/unit/gm/command_write_iteration.o: src/test/test-models/no-main/gm/test_lp.cpp
test/unit/gm/generator.o: src/test/test-models/no-main/gm/test_lp.cpp

test/unit/model/util.o: src/test/test-models/no-main/model/valid.cpp src/test/test-models/no-main/model/domain_fail.cpp
Expand All @@ -203,21 +195,13 @@ test/unit/mcmc/hmc/hamiltonians/base_hamiltonian.o: src/test/test-models/no-main
test/unit/mcmc/hmc/hamiltonians/unit_e_metric.o: src/test/test-models/no-main/mcmc/hmc/hamiltonians/funnel.cpp
test/unit/mcmc/hmc/hamiltonians/diag_e_metric.o: src/test/test-models/no-main/mcmc/hmc/hamiltonians/funnel.cpp
test/unit/mcmc/hmc/hamiltonians/dense_e_metric.o: src/test/test-models/no-main/mcmc/hmc/hamiltonians/funnel.cpp
test/unit/mcmc/hmc/integrators/expl_leapfrog.o: src/test/test-models/no-main/mcmc/hmc/integrators/command.cpp src/test/test-models/no-main/mcmc/hmc/integrators/gauss.cpp

##
# all files that should be compiled as tests
##
FILES := $(shell find src/test/test-models/compiled -type f -name '*.stan')
test/unit/mcmc/hmc/integrators/expl_leapfrog.o: src/test/test-models/no-main/mcmc/hmc/integrators/command.cpp
test/unit/mcmc/hmc/integrators/expl_leapfrog2.o: src/test/test-models/no-main/mcmc/hmc/integrators/gauss.cpp

test/integration/compile_models.o : $(patsubst %.stan,%$(EXE),$(FILES)) $(patsubst %.stan,%.cpp-test,$(wildcard src/test/test-models/syntax-only/*stan))
test/unit/common/command_init.o: src/test/test-models/no-main/common/test_lp.cpp
test/unit/common/write_iteration.o: src/test/test-models/no-main/common/test_lp.cpp

test/CmdStan/command.o: \
$(addprefix src/test/test-models/compiled/CmdStan/,\
$(addsuffix $(EXE), printer domain_fail value_fail proper))
test/CmdStan/gm/argument_configuration.o: src/test/test-models/compiled/CmdStan/test_model$(EXE)
test/CmdStan/fixed_param_sampler.o: src/test/test-models/compiled/CmdStan/empty$(EXE) src/test/test-models/compiled/CmdStan/proper$(EXE)
test/CmdStan/optimization_output.o: src/test/test-models/compiled/CmdStan/optimization_output$(EXE)
test/integration/compile_models.o : $(patsubst %.stan,%.cpp-test,$(wildcard src/test/test-models/syntax-only/*stan))

##
# CmdStan specific targets. Should be removed in the future.
Expand All @@ -226,12 +210,6 @@ $(patsubst src/%_test.cpp,%.o,$(filter src/test/CmdStan/%,$(ALL_TESTS))): test/%
@mkdir -p $(dir $@)
$(COMPILE.c) -O$O $(CFLAGS_GTEST) $< $(OUTPUT_OPTION)

##
# CmdStan model tests. Adding built model as a dependency.
##
$(patsubst src/%_test.cpp,%.o,$(filter src/test/CmdStan/models/%,$(ALL_TESTS))): test/CmdStan/%.o : %$(EXE)


##
# Agrad distributions test generator
##
Expand Down Expand Up @@ -289,7 +267,7 @@ test-headers: $(HEADER_TESTS)
# Deprecated test targets
##
.PHONY: test-unit test-distributions test-models test-bugs
test-unit test-distributions test-models test-bugs test-all:
test-unit test-distributions test-all:
@echo ''
@echo ''
@echo ' The '$@' target is deprecated. Please use these make targets instead:'
Expand All @@ -299,9 +277,23 @@ test-unit: src/test/unit src/test/unit-agrad-rev src/test/unit-agrad-fwd

test-distributions: src/test/unit-distribution

test-models: src/test/CmdStan/models
test-models:
@echo ''
@echo 'These tests are now in the CmdStan repository. Run this from'
@echo 'the CmdStan directory:'
@echo ''
@echo ' "> make src/test/models"'
@echo ''
$(error Tests have moved to the CmdStan repository. Run "> make src/test/models")

test-bugs: src/test/CmdStan/models/bugs_examples
test-bugs:
@echo ''
@echo 'These tests are now in the CmdStan repository. Run this from'
@echo 'the CmdStan directory:'
@echo ''
@echo ' "> make src/test/models/bugs_examples"'
@echo ''
$(error Tests have moved to the CmdStan repository. Run "> make src/test/models/bugs_examples")


.PHONY: test-all
Expand Down
4 changes: 3 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ SUFIXES:
# - CC: The compiler to use. Expecting g++ or clang++.
# - O: Optimization level. Valid values are {0, 1, 2, 3}.
# - AR: archiver (must specify for cross-compiling)
# - OS: {mac, win, linux}.
# - OS: {mac, win, linux}
# - C++11: Compile with C++11 extensions, Valid values: {true, false}.
##
CC = g++
O = 3
O_STANC = 0
AR = ar
C++11 = false

##
# Library locations
Expand Down
4 changes: 2 additions & 2 deletions src/docs/stan-reference/appendices.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

\part*{Appendices}
\addcontentsline{toc}{part}{Appendices}

Expand Down Expand Up @@ -333,10 +332,11 @@ \subsection{Rtools C++ Development Environment}
Authoring}, click \code{Next},
\item \emph{Select Additional Tasks}: check \code{Edit Path} and \code{Save
Version in Registry}, click \code{Next},
\item \emph{System Path Report}: click \code{Next},
\item \emph{System Path Report}: ensure that that the paths to \code{c:\textbackslash{}Rtools\textbackslash{}bin} and \code{c:\textbackslash{}Rtools\textbackslash{}gcc-4.6.3\textbackslash{}bin} are listed at the beginning of the path and click \code{Next},
\item \emph{Ready to Install}: click \code{Next}, wait for the
install to complete, then
\item \emph{Finish}: click \code{Finish}.
\item \emph{Confirm Path}: After the install has completed, open a command prompt and type \code{PATH} to ensure that the new path is activated and the Rtools folders are in the system path.
\end{itemize}

\subsection{Downloading and Unpacking Stan}
Expand Down
59 changes: 57 additions & 2 deletions src/docs/stan-reference/functions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,25 @@ \section{Array Broadcasting}\label{array-broadcasting.section}
\code{k} in \code{1:4}, \code{m} in \code{1:5}, and \code{n} in
\code{1:6}.

\section{Other functions}
\section{Sorting functions}\label{sorting-functions.section}

Sorting can be used to sort values or the indices of those values in
either ascending or descending order. For example, if \code{v} is
declared as a real array of size 3, with values
\[
\mbox{\code{v}} = (1, -10.3, 20.987),
\]
then the various sort routines produce
%
\begin{eqnarray*}
\mbox{\code{sort\_asc(v)}} & = & (-10.3,1,20.987)
\\[4pt]
\mbox{\code{sort\_desc(v)}} & = & (20.987,1,-10.3)
\\[4pt]
\mbox{\code{sort\_indices\_asc(v)}} & = & (2,1,3)
\\[4pt]
\mbox{\code{sort\_indices\_desc(v)}} & = & (3,1,2)
\end{eqnarray*}

\begin{description}
%
Expand All @@ -1259,6 +1277,22 @@ \section{Other functions}
\fitem{int[]}{sort\_desc}{int[] \farg{v}}{
Sort the elements of \farg{v} in descending order}
%
\fitem{int[]}{sort\_indices\_asc}{real[] \farg{v}}{
Return an array of indices between 1 and the size of \farg{v},
sorted to index \farg{v} in ascending order.}
%
\fitem{int[]}{sort\_indices\_asc}{int[] \farg{v}}{
Return an array of indices between 1 and the size of \farg{v},
sorted to index \farg{v} in ascending order.}
%
\fitem{int[]}{sort\_indices\_desc}{real[] \farg{v}}{
Return an array of indices between 1 and the size of \farg{v},
sorted to index \farg{v} in descending order.}
%
\fitem{int[]}{sort\_indices\_desc}{int[] \farg{v}}{
Return an array of indices between 1 and the size of \farg{v},
sorted to index \farg{v} in descending order.}
%
\fitem{int}{rank}{real[] \farg{v}, int \farg{s}}{
Number of components of \farg{v} less than \farg{v[s]}}
%
Expand All @@ -1267,6 +1301,7 @@ \section{Other functions}
%
\end{description}


\chapter{Matrix Operations}\label{matrix-operations.chapter}
\noindent

Expand Down Expand Up @@ -2185,7 +2220,11 @@ \subsubsection{Singular Value Decomposition}
\end{description}


\section{Other functions}
\section{Sort Functions}

See \refsection{sorting-functions} for examples of how the functions
work.

\begin{description}
%
\fitem{vector}{sort\_asc}{vector \farg{v}}{
Expand All @@ -2200,6 +2239,22 @@ \section{Other functions}
\fitem{row\_vector}{sort\_desc}{row\_vector \farg{v}}{
Sort the elements of \farg{v} in descending order}
%
\fitem{int[]}{sort\_indices\_asc}{vector \farg{v}}{
Return an array of indices between 1 and the size of \farg{v},
sorted to index \farg{v} in ascending order.}
%
\fitem{int[]}{sort\_indices\_asc}{row\_vector \farg{v}}{
Return an array of indices between 1 and the size of \farg{v},
sorted to index \farg{v} in ascending order.}
%
\fitem{int[]}{sort\_indices\_desc}{vector \farg{v}}{
Return an array of indices between 1 and the size of \farg{v},
sorted to index \farg{v} in descending order.}
%
\fitem{int[]}{sort\_indices\_desc}{row\_vector \farg{v}}{
Return an array of indices between 1 and the size of \farg{v},
sorted to index \farg{v} in descending order.}
%
\fitem{int}{rank}{vector \farg{v}, int \farg{s}}{
Number of components of \farg{v} less than \farg{v[s]}}
%
Expand Down
4 changes: 2 additions & 2 deletions src/docs/stan-reference/introduction.tex
Original file line number Diff line number Diff line change
Expand Up @@ -898,8 +898,8 @@ \subsubsection{Jacobian Required Warning}
how to calculate the required Jacobian adjustment and apply it in a model.

In linear transforms or matrix/array slicing, spurious warnings
arise. Ane example is the following model, which involves extraction
of a rwo from a matrix for vectorized sampling.
arise. An example is the following model, which involves extraction
of a row from a matrix for vectorized sampling.
%
\begin{quote}
\begin{Verbatim}
Expand Down
20 changes: 20 additions & 0 deletions src/stan/common.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#ifndef __STAN__COMMON_HPP___
#define __STAN__COMMON_HPP___

#include <stan/common/command.hpp>
#include <stan/common/do_print.hpp>
#include <stan/common/init_adapt.hpp>
#include <stan/common/init_nuts.hpp>
#include <stan/common/init_static_hmc.hpp>
#include <stan/common/init_windowed_adapt.hpp>
#include <stan/common/print_progress.hpp>
#include <stan/common/run_markov_chain.hpp>
#include <stan/common/sample.hpp>
#include <stan/common/warmup.hpp>
#include <stan/common/write_error_msg.hpp>
#include <stan/common/write_iteration.hpp>
#include <stan/common/write_iteration_csv.hpp>
#include <stan/common/write_model.hpp>
#include <stan/common/write_stan.hpp>

#endif
Loading

0 comments on commit f1373d2

Please sign in to comment.