diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..78ed7f299 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,7 @@ +*.m linguist-vendored +*.dat linguist-vendored +*.tab linguist-vendored +*.txt linguist-vendored +*.C linguist-language=C++ +*.h linguist-language=C++ +*.cpp linguist-language=C++ diff --git a/.gitignore b/.gitignore index 670ecd724..13c6dc6bb 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,8 @@ queso-*tar.gz Makefile.in Makefile !manual/Makefile +manual/mixed_effects/*.pdf +manual/mixed_effects/*.aux libtool sl6-config stamp-h1 @@ -81,6 +83,12 @@ examples/outputData examples/template_eg examples/template_example/outputData examples/template_example/template_example +examples/scalarCovariance +examples/diagonalCovariance +examples/fullCovariance +examples/blockDiagonalCovariance +examples/fullCovarianceRandomCoefficient +examples/blockDiagonalCovarianceRandomCoefficients src/core/inc/queso.h src/libqueso.la @@ -161,5 +169,22 @@ test/test_Regression/test_jeffreys_samples_diff.sh test/test_adaptedcov_output/ test/test_gpmsa_cobra_output/ test/test_logitadaptedcov +test/test_scalarCovariance +test/test_diagonalCovariance +test/test_fullCovariance +test/test_blockDiagonalCovariance +test/test_output_gaussian_likelihoods +test/test_gaussian_likelihoods/queso_input.txt +test/test_GslBlockMatrixInvertMultiply test/test_SequenceOfVectors/test_unifiedPositionsOfMaximum.sh test/test_unifiedPositionsOfMaximum +test/test_VectorPdf_gsl +test/test_VectorRV_gsl +test/test_VectorRealizer_gsl +test/test_fullCovarianceRandomCoefficient +test/test_blockDiagonalCovarianceRandomCoefficients +test/test_gaussian_likelihoods/gaussian_consistency_input.txt +test/test_fullCovarianceChain +test/test_diagonalCovarianceChain +test/test_scalarCovarianceChain +test/test_blockDiagonalCovarianceChain diff --git a/.travis.yml b/.travis.yml index f85ae080d..4faf0838b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,5 +4,8 @@ compiler: - clang before_script: - sudo apt-get update -qq - - sudo apt-get install -qq libgsl0-dev libmpich2-dev libboost-all-dev -script: ./bootstrap && ./configure && make && make check + - sudo apt-get install -q build-essential + - sudo apt-get install -q libgsl0-dev + - sudo apt-get install -q openmpi-bin openmpi-dev + - sudo apt-get install -q libboost-all-dev +script: ./bootstrap && CC="mpicc" CXX="mpicxx" ./configure && make -j2 && make check diff --git a/CHANGES b/CHANGES index a102d7962..7523e95af 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,9 @@ QUESO: Quantification of Uncertainty for Estimation, Simulation, and Optimization. ----------------------------------------------------- +Version 0.52.0 + * Add canned Gaussian likelihoods + Version 0.51.0 * Add canned likelihood for scalar GPMSA use-case a la Higdon et al * Add a logit-transformed transition kernel for more efficient proposals diff --git a/COPYING b/COPYING index 7e6dbc15b..ca4f73b7b 100644 --- a/COPYING +++ b/COPYING @@ -158,7 +158,7 @@ Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. - + 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 @@ -216,7 +216,7 @@ instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. - + Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. @@ -267,7 +267,7 @@ Library will still fall under Section 6.) distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. - + 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work @@ -370,7 +370,7 @@ subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. - + 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or @@ -422,7 +422,7 @@ conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. - + 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is @@ -454,4 +454,3 @@ RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - diff --git a/LICENSE b/LICENSE index 6703e267c..00846c2cb 100644 --- a/LICENSE +++ b/LICENSE @@ -4,7 +4,7 @@ // QUESO - a library to support the Quantification of Uncertainty // for Estimation, Simulation and Optimization // -// Copyright (C) 2008,2009,2010,2011,2012,2013 The PECOS Development Team +// Copyright (C) 2008-2015 The PECOS Development Team // // This library is free software; you can redistribute it and/or // modify it under the terms of the Version 2.1 GNU Lesser General diff --git a/configure.ac b/configure.ac index ec2944374..f3955868b 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.65) -AC_INIT([queso], [0.51.1], [queso-users@googlegroups.com]) +AC_INIT([queso], [0.52.0], [queso-users@googlegroups.com]) PACKAGE_DESCRIPTION="The parallel C++ statistical library QUESO: Quantification of uncertainty for estimation, simulation and optimization" AC_SUBST([PACKAGE_DESCRIPTION]) PACKAGE_URL="https://github.com/libqueso/queso" @@ -108,7 +108,7 @@ AM_CONDITIONAL(TRILINOS_ENABLED,test x$HAVE_TRILINOS = x1) AC_CACHE_SAVE # Check for libmesh (optional) -AX_PATH_LIBMESH_NEW(0.8.0,no) +AX_PATH_LIBMESH_NEW(0.9.1,no) AC_CACHE_SAVE # Check for GSL (required) @@ -198,26 +198,40 @@ AC_CONFIG_FILES([ test/test_infinite/inf_options test/test_Regression/GaussianMean1DRegression_options test/test_Regression/gpmsa_cobra_input.txt - test/test_Regression/test_cobra_samples_diff.sh test/test_Regression/test_gpmsa_cobra_samples.m test/test_Regression/ctf_dat.txt test/test_Regression/dakota_pstudy.dat - test/test_StatisticalInverseProblem/test_LlhdTargetOutput.sh test/test_StatisticalInverseProblem/both_input.txt test/test_StatisticalInverseProblem/llhdout_input.txt test/test_StatisticalInverseProblem/neither_input.txt test/test_StatisticalInverseProblem/targetout_input.txt test/test_Regression/jeffreys_input.txt - test/test_Regression/test_jeffreys_samples_diff.sh test/test_Regression/test_jeffreys_samples.m test/test_Regression/adaptedcov_input.txt + test/test_gaussian_likelihoods/queso_input.txt doxygen/Makefile doxygen/queso.dox doxygen/txt_common/about_vpath.page + test/test_gaussian_likelihoods/gaussian_consistency_input.txt +]) + +AC_CONFIG_FILES([test/test_Regression/test_cobra_samples_diff.sh ], [ chmod +x test/test_Regression/test_cobra_samples_diff.sh +]) + +AC_CONFIG_FILES([ + test/test_StatisticalInverseProblem/test_LlhdTargetOutput.sh +], +[ chmod +x test/test_StatisticalInverseProblem/test_LlhdTargetOutput.sh +]) + +AC_CONFIG_FILES([ + test/test_Regression/test_jeffreys_samples_diff.sh +], +[ chmod +x test/test_Regression/test_jeffreys_samples_diff.sh ]) diff --git a/convertQuesoMFileToTxt.py b/convertQuesoMFileToTxt.py new file mode 100644 index 000000000..06a633f8c --- /dev/null +++ b/convertQuesoMFileToTxt.py @@ -0,0 +1,147 @@ +""" + -----------------------------------------------------------------------bl- + -------------------------------------------------------------------------- + + QUESO - a library to support the Quantification of Uncertainty + for Estimation, Simulation and Optimization + + Copyright (C) 2008,2009,2010,2011,2012,2013 The PECOS Development Team + + This library is free software; you can redistribute it and/or + modify it under the terms of the Version 2.1 GNU Lesser General + Public License as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc. 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301 USA + +-----------------------------------------------------------------------el- + + This module contains a utility funtion, convertMFile, for converting m-files + generated by QUESO into regular text. See the convertMFile help string for more + specific information on usage and output. Conversion can also be accomplished + by invoking convertQuesoMFileToTxt.py on the command line. In this case, + the script will parse a list of input m-files and create text file output + for each m-file. The script separates the chain data, likelihood data, and + target data into separate output files. For more information on the command + version, run: python convertQuesoMFileToTxt.py --help + +""" + +import re +import sys + +def convertMFile(mFileName, getChain=True, getLike=True, + getTarget=True, chainIdent='[cC]hain', + likeIdent='[lL]ikelihood', targetIdent='[tT]arget'): + """ + + This function parses chain, likelihood, and target data from a single m-file. + mFileName specifies the name of m-file to parse. The get{Chain,Like,Target} + optional inputs take boolean values indicating if the function should parse + that particular item from the file. The {chain,like,target}Ident optional + inputs allow the user to specify a regular expression that identifies that + particular item in the m-file. This function returns a dictionary + containing keys, 'chain', 'logLikelihood', and 'logTarget'. The value + associated with a particular key is the data for that item in character + string format. If the data for an item cannot be found in the file, the + key for that item will not be present in the dictionary. + + """ + + # tokens delimiting the data + dataEncloseTokens = ('[', ']') + + # Read file into string buffer + fIn = open(mFileName,'r') + fileBuf = fIn.read() + fIn.close() + + outputMap = dict() + parseMap = {'chain': (getChain, chainIdent), 'logLikelihood': (getLike, likeIdent), + 'logTarget': (getTarget, targetIdent)} + + # iterate over wanted items and parse them from the buffer + for item in parseMap: + if parseMap[item][0] == False: + continue + + # Find tag for current item via search with regex: identString\w*\s*=\s*(?=\[) + parseTagRegEx = parseMap[item][1] + r'\w*\s*=\s*' + '(?=' + re.escape(dataEncloseTokens[0]) + ')' + match = re.search(parseTagRegEx, fileBuf) + tag = '' + if match: + tag = match.group(0) + re.escape(dataEncloseTokens[0]) + else: + print 'Error: Could not find identifier {0} in {1}. Regex string: {2}'.format(item, mFileName, parseTagRegEx) + return outputMap + + # Extract current item data between [ ] via search with regex: (?<=tag)[^\]]+ + parseDataRegEx = '(?<=' + tag + ')[^' + re.escape(dataEncloseTokens[1]) + ']+' + match = re.search(parseDataRegEx, fileBuf) + if match: + outputMap[item] = match.group(0) + else: + print 'Error: Could not find {0} data in {1}. Regex string: {2}'.format(item, mFileName, parseDataRegEx) + return outputMap + + return outputMap + + +if __name__ == "__main__": + import argparse + + parser = argparse.ArgumentParser(description='Convert a list of m-files generated by QUESO into text files.') + parser.add_argument('-c', '--chain', type=str, choices=['yes','no'], default='yes', + help='Parse chain data from m-file (default: yes)') + parser.add_argument('-l', '--likelihood', type=str, choices=['yes','no'], default='yes', + help='Parse likelihood data from m-file (default: yes)') + parser.add_argument('-t', '--target', type=str, choices=['yes','no'], default='yes', + help='Parse target data from m-file (default: yes)') + + parser.add_argument('-ci', '--chain_identifier', type=str, default='[cC]hain', + help='RegEx string identifying chain entry in the m-file (default: [cC]hain)') + parser.add_argument('-li', '--likelihood_identifier', type=str, default='[lL]ikelihood', + help='RegEx string identifying likelihood entry in the m-file (default: [lL]ikelihood)') + parser.add_argument('-ti', '--target_identifier', type=str, default='[tT]arget', + help='RegEx string identifying target entry in the m-file (default: [tT]arget)') + + parser.add_argument('mFileList', nargs='+', help='List of m-files to convert') + + args = parser.parse_args() + + if args.chain == 'yes': + getChainOpt = True + else: + getChainOpt = False + + if args.likelihood == 'yes': + getLikeOpt = True + else: + getLikeOpt = False + + if args.target == 'yes': + getTargetOpt = True + else: + getTargetOpt = False + + # process files one-by-one + for mFileName in args.mFileList: + outputMap = convertMFile(mFileName, getChain=getChainOpt, getLike=getLikeOpt, getTarget=getTargetOpt, \ + chainIdent=args.chain_identifier, likeIdent=args.likelihood_identifier, \ + targetIdent=args.target_identifier) + + # Write the data out to text files + mFileNameBase = mFileName.rstrip('.m') + for item in outputMap: + outFileName = mFileNameBase + '_' + item + '.txt' + fOut = open(outFileName, 'w') + fOut.write(outputMap[item]) + fOut.close() + print 'Created file {0}...'.format(outFileName) diff --git a/doxygen/queso.page b/doxygen/queso.page index d87d4a692..2f1f8910e 100644 --- a/doxygen/queso.page +++ b/doxygen/queso.page @@ -21,7 +21,7 @@ based/html format. Bugs in the code and errors or omissions in the documentation can be reported to queso-users@googlegroups.com or as a -GitHub ticket. Requests and contributions are also welcome using either of the two methods mentioned above. @@ -36,11 +36,10 @@ All bug reports should include: \section bugs Regression Testing